<?php

namespace App\Models;

use App\Libs\DataFormat;
use Hashids\Hashids;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Platform extends Model
{

    use DataFormat;

    protected $table = 'platform';
    protected $dates = [''];

    protected $guarded = ['id', 'created_at'];

    protected  $casts = ['org_list'=>'array'];

    public static function gePlatformInfo()
    {
        $platform = request()->header('X-platform-code', '');

        $hashids = new Hashids('', 10);

        $platCode = $hashids->decode($platform);

        if(empty($platCode))
        {
            return false;
        }

        $platform = Platform::where('id', $platCode)->first();

        return $platform;
    }



}
